package Data::Semantic::URI::ftp;

use strict;
use warnings;


our $VERSION = '0.02';


use base qw(Data::Semantic::URI);


__PACKAGE__
    ->mk_scalar_accessors(qw(type))
    ->mk_boolean_accessors(qw(password));


use constant REGEXP_KEYS => qw(URI FTP);
use constant KEEP_KEYS   => qw(
    URI scheme username password host port abspath_full abspath_full_no_slash
    abspath_full_no_slash_no_query type
);


sub flags {
    my $self = shift;
    my @flags = $self->SUPER::flags(@_);
    push @flags => sprintf("-type => '%s'", $self->type) if $self->type;
    push @flags => '-password' if $self->password;
    @flags;
}




1;


__END__

{% USE p = PodGenerated %}

=head1 NAME

{% p.package %} - semantics for FTP URIs

=head1 SYNOPSIS

    my $obj = {% p.package %}->new;
    if ($obj->is_well_formed($value)) { ... }

=head1 DESCRIPTION

This class can tell whether a value is an FTP URI, as defined by RFCs 1738 and
2396. The C<valid()> method will respect the C<type> and C<password>
attributes and the inherited C<keep> boolean attribute.

See L<Regexp::Common::URI::ftp> for the meaning of C<type> and C<password>.

If C<keep> is set, C<kept()> will return a hash with the following keys/value
pairs:

=over 4

=item URI

The complete URI.

=item scheme

The scheme.

=item username

The userinfo, or if C<password> is used, the username.

=item password

If C<password> is used, the password, else "undef".

=item host

The hostname or IP address.

=item port

The port number

=item abspath_full

The full path and type specification, including the leading slash.

=item abspath_full_no_slash

The full path and type specification, without the leading slash.

=item abspath_full_no_slash_no_query

The full path, without the type specification nor the leading slash.

=item type

The value of the type specification.

=back

{% p.write_inheritance %}

=head1 METHODS

=over 4

{% p.write_methods %}

=back

{% PROCESS standard_pod %}

=head1 SEE ALSO

L<Regexp::Common::URI::ftp>

=cut

